Model Selection

We want real-time inference and have very little data to work with, so we will select a pre-trained MobileNet_V2 as a model for image classification.

Image preprocessing

Since the objective is image classification using a model that was pre-trained on ImageNet, we will use the following transformations:

Dataset V2

The original dataset was restructured to make use of native pytorch helper functions. As a result, the the labels files are no longer needed and images are placed in the following directory structure:

Due to the way Pytorch reads directories, the classes are assigned differently.

This is significant, because that changes the way we evaluate the model. The binary indicator for non-emergency vehicles is 1. The assumed priority is the 0 class, meaning that the metric of interest if our goal is to maximize the detection of emergency vehicles will be recall rather than precision.

The model's outputs are logits, and once exponentiated, represent the estimated likelihood that an object is a non-emergency vehicle. The conversion we can apply to change the exponentiated output is (1 - x) * 100

Save and Reload Model

Model Validation

Sample from the Validation Set

These randomly selected images are from the validation set. For presentation purposes, I am partially reversing the normalization procedure.

Model Performance

The model correctly identified 100% of 16 images in this validation sample.